package com.sso.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 系统用户表
 * 
 * @author lulei
 * 
 */
@Entity
@Table(name = "sso_DicSystemUser")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@NamedQueries( {
		@NamedQuery(name = "dsu.getUserByID", query = "select user from DicSystemUser as user where user.id=?"),
		@NamedQuery(name = "dsu.getUserByName", query = "select user from DicSystemUser as user where user.userName=?") })
public class DicSystemUser {
	/**
	 * ID
	 */
	@Id
	private String id;

	/**
	 * 用户名称
	 */
	private String userName;

	/**
	 * 用户密码
	 */
	private String userPassword;

	@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	private Set<DicUserHuman> duhs;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserPassword() {
		return userPassword;
	}

	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}

	public Set<DicUserHuman> getDuhs() {
		return duhs;
	}

	public void setDuhs(Set<DicUserHuman> duhs) {
		this.duhs = duhs;
	}
}
